/*
 * Copyright (C) 2005, Velocityme Partnership
 * LicenceKeyFloating.java
 *
 * Created on 21 June 2005, 06:16
 */

package com.velocityme.utility;

import java.util.Date;

/**
 *
 * @author  Robert
 */
public class LicenceKeyFloating extends LicenceKey {
    
    private int m_number;
    
    /** Creates a new instance of LicenceKeyFloating */
    public LicenceKeyFloating(Date p_expiryDate, String p_clientGUID, int p_number) {
        super(p_expiryDate, p_clientGUID);
        m_number = p_number;
    }
    
    public LicenceKeyFloating() {
    }
    
    public int getNumber() { return m_number; }
    public void setNumber(int p_number) { m_number = p_number; }
    
    public String toString() {
        return "Floating: " + m_number;
    }
    
    public boolean addNewSession(int p_numCurrentSessions, String p_username) {
        return isValid() && p_numCurrentSessions < m_number;
    }
    
}
